home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / autose1g / frmlaunc.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-06-24  |  19.1 KB  |  565 lines

  1. VERSION 5.00
  2. Begin VB.Form frmLaunch 
  3.    BackColor       =   &H00400000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Launching..."
  6.    ClientHeight    =   3435
  7.    ClientLeft      =   1500
  8.    ClientTop       =   1890
  9.    ClientWidth     =   6315
  10.    ControlBox      =   0   'False
  11.    KeyPreview      =   -1  'True
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    PaletteMode     =   1  'UseZOrder
  16.    ScaleHeight     =   3435
  17.    ScaleWidth      =   6315
  18.    ShowInTaskbar   =   0   'False
  19.    Begin VB.CheckBox chkCloak 
  20.       BackColor       =   &H00400000&
  21.       Caption         =   " Cloaking Device"
  22.       Enabled         =   0   'False
  23.       BeginProperty Font 
  24.          Name            =   "MS Sans Serif"
  25.          Size            =   8.25
  26.          Charset         =   0
  27.          Weight          =   700
  28.          Underline       =   0   'False
  29.          Italic          =   0   'False
  30.          Strikethrough   =   0   'False
  31.       EndProperty
  32.       ForeColor       =   &H0000FFFF&
  33.       Height          =   270
  34.       Left            =   705
  35.       TabIndex        =   13
  36.       Top             =   2115
  37.       Width           =   1830
  38.    End
  39.    Begin VB.CommandButton cmdCancel 
  40.       Caption         =   "&Cancel"
  41.       BeginProperty Font 
  42.          Name            =   "MS Sans Serif"
  43.          Size            =   9.75
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Height          =   330
  51.       Left            =   3900
  52.       TabIndex        =   12
  53.       Top             =   2475
  54.       Width           =   1230
  55.    End
  56.    Begin VB.CommandButton cmdLaunchShip 
  57.       Caption         =   "&Launch"
  58.       Enabled         =   0   'False
  59.       BeginProperty Font 
  60.          Name            =   "MS Sans Serif"
  61.          Size            =   9.75
  62.          Charset         =   0
  63.          Weight          =   400
  64.          Underline       =   0   'False
  65.          Italic          =   0   'False
  66.          Strikethrough   =   0   'False
  67.       EndProperty
  68.       Height          =   330
  69.       Left            =   3900
  70.       TabIndex        =   11
  71.       Top             =   1980
  72.       Width           =   1230
  73.    End
  74.    Begin VB.Frame fraAdvancedShip 
  75.       BackColor       =   &H00400000&
  76.       Caption         =   "Advanced Tactics"
  77.       BeginProperty Font 
  78.          Name            =   "MS Sans Serif"
  79.          Size            =   8.25
  80.          Charset         =   0
  81.          Weight          =   700
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       ForeColor       =   &H0000FFFF&
  87.       Height          =   1305
  88.       Left            =   435
  89.       TabIndex        =   10
  90.       Top             =   1725
  91.       Width           =   2460
  92.       Begin VB.CheckBox chkSabotage 
  93.          BackColor       =   &H00400000&
  94.          Caption         =   " Sabotage Mission"
  95.          Enabled         =   0   'False
  96.          BeginProperty Font 
  97.             Name            =   "MS Sans Serif"
  98.             Size            =   8.25
  99.             Charset         =   0
  100.             Weight          =   700
  101.             Underline       =   0   'False
  102.             Italic          =   0   'False
  103.             Strikethrough   =   0   'False
  104.          EndProperty
  105.          ForeColor       =   &H000000FF&
  106.          Height          =   240
  107.          Left            =   270
  108.          TabIndex        =   14
  109.          Top             =   810
  110.          Width           =   1935
  111.       End
  112.    End
  113.    Begin VB.Frame Frame1 
  114.       BackColor       =   &H00400000&
  115.       Caption         =   "Select Ship"
  116.       BeginProperty Font 
  117.          Name            =   "MS Sans Serif"
  118.          Size            =   8.25
  119.          Charset         =   0
  120.          Weight          =   700
  121.          Underline       =   0   'False
  122.          Italic          =   0   'False
  123.          Strikethrough   =   0   'False
  124.       EndProperty
  125.       ForeColor       =   &H0000FFFF&
  126.       Height          =   1245
  127.       Left            =   450
  128.       TabIndex        =   7
  129.       Top             =   360
  130.       Width           =   1485
  131.       Begin VB.CommandButton cmdShip2 
  132.          Caption         =   "Ship 2"
  133.          Height          =   285
  134.          Left            =   195
  135.          TabIndex        =   9
  136.          Top             =   780
  137.          Width           =   1000
  138.       End
  139.       Begin VB.CommandButton cmdShip1 
  140.          Caption         =   "Ship 1"
  141.          Height          =   285
  142.          Left            =   195
  143.          TabIndex        =   8
  144.          Top             =   255
  145.          Width           =   1000
  146.       End
  147.    End
  148.    Begin VB.Frame fraTactical 
  149.       BackColor       =   &H00400000&
  150.       Caption         =   "Personnel"
  151.       Enabled         =   0   'False
  152.       BeginProperty Font 
  153.          Name            =   "MS Sans Serif"
  154.          Size            =   8.25
  155.          Charset         =   0
  156.          Weight          =   700
  157.          Underline       =   0   'False
  158.          Italic          =   0   'False
  159.          Strikethrough   =   0   'False
  160.       EndProperty
  161.       ForeColor       =   &H0000FFFF&
  162.       Height          =   1245
  163.       Left            =   2235
  164.       TabIndex        =   0
  165.       Top             =   360
  166.       Width           =   3600
  167.       Begin VB.HScrollBar hsbTroopsOnShip 
  168.          Enabled         =   0   'False
  169.          Height          =   255
  170.          LargeChange     =   2
  171.          Left            =   960
  172.          Max             =   1000
  173.          TabIndex        =   2
  174.          Top             =   270
  175.          Width           =   2040
  176.       End
  177.       Begin VB.HScrollBar hsbAssaultTroopsOnShip 
  178.          Enabled         =   0   'False
  179.          Height          =   255
  180.          LargeChange     =   2
  181.          Left            =   930
  182.          Max             =   1000
  183.          TabIndex        =   1
  184.          Top             =   795
  185.          Width           =   2070
  186.       End
  187.       Begin VB.Label lblRegularTroops 
  188.          BackColor       =   &H00400000&
  189.          Caption         =   "Troops:"
  190.          BeginProperty Font 
  191.             Name            =   "MS Sans Serif"
  192.             Size            =   8.25
  193.             Charset         =   0
  194.             Weight          =   700
  195.             Underline       =   0   'False
  196.             Italic          =   0   'False
  197.             Strikethrough   =   0   'False
  198.          EndProperty
  199.          ForeColor       =   &H0000FFFF&
  200.          Height          =   210
  201.          Left            =   135
  202.          TabIndex        =   6
  203.          Top             =   315
  204.          Width           =   735
  205.       End
  206.       Begin VB.Label lblNumRegularTroops 
  207.          BackStyle       =   0  'Transparent
  208.          Caption         =   "x"
  209.          BeginProperty Font 
  210.             Name            =   "MS Sans Serif"
  211.             Size            =   8.25
  212.             Charset         =   0
  213.             Weight          =   700
  214.             Underline       =   0   'False
  215.             Italic          =   0   'False
  216.             Strikethrough   =   0   'False
  217.          EndProperty
  218.          ForeColor       =   &H0000FFFF&
  219.          Height          =   240
  220.          Left            =   3135
  221.          TabIndex        =   5
  222.          Top             =   270
  223.          Width           =   360
  224.       End
  225.       Begin VB.Label lblAssaultTroops 
  226.          BackStyle       =   0  'Transparent
  227.          Caption         =   "Mechs:"
  228.          BeginProperty Font 
  229.             Name            =   "MS Sans Serif"
  230.             Size            =   8.25
  231.             Charset         =   0
  232.             Weight          =   700
  233.             Underline       =   0   'False
  234.             Italic          =   0   'False
  235.             Strikethrough   =   0   'False
  236.          EndProperty
  237.          ForeColor       =   &H0000FFFF&
  238.          Height          =   210
  239.          Left            =   165
  240.          TabIndex        =   4
  241.          Top             =   795
  242.          Width           =   735
  243.       End
  244.       Begin VB.Label lblNumAssaultTroops 
  245.          BackStyle       =   0  'Transparent
  246.          Caption         =   "x"
  247.          BeginProperty Font 
  248.             Name            =   "MS Sans Serif"
  249.             Size            =   8.25
  250.             Charset         =   0
  251.             Weight          =   700
  252.             Underline       =   0   'False
  253.             Italic          =   0   'False
  254.             Strikethrough   =   0   'False
  255.          EndProperty
  256.          ForeColor       =   &H0000FFFF&
  257.          Height          =   225
  258.          Left            =   3135
  259.          TabIndex        =   3
  260.          Top             =   795
  261.          Width           =   360
  262.       End
  263.    End
  264.    Begin VB.Image Image4 
  265.       Height          =   195
  266.       Left            =   195
  267.       Picture         =   "FRMLAUNC.frx":0000
  268.       Stretch         =   -1  'True
  269.       Top             =   3240
  270.       Width           =   5850
  271.    End
  272.    Begin VB.Image Image3 
  273.       Height          =   180
  274.       Left            =   195
  275.       Picture         =   "FRMLAUNC.frx":42D2
  276.       Stretch         =   -1  'True
  277.       Top             =   15
  278.       Width           =   5880
  279.    End
  280.    Begin VB.Image Image2 
  281.       Height          =   3480
  282.       Left            =   6075
  283.       Picture         =   "FRMLAUNC.frx":85A4
  284.       Stretch         =   -1  'True
  285.       Top             =   -45
  286.       Width           =   225
  287.    End
  288.    Begin VB.Image Image1 
  289.       Height          =   3420
  290.       Left            =   15
  291.       Picture         =   "FRMLAUNC.frx":BEC6
  292.       Stretch         =   -1  'True
  293.       Top             =   0
  294.       Width           =   195
  295.    End
  296. Attribute VB_Name = "frmLaunch"
  297. Attribute VB_GlobalNameSpace = False
  298. Attribute VB_Creatable = False
  299. Attribute VB_PredeclaredId = True
  300. Attribute VB_Exposed = False
  301. Option Explicit
  302. Private Sub chkCloak_Click()
  303. Dim CloakingCost As Integer
  304. CloakingCost = 3
  305. 'see if player can afford to use the cloaking device
  306. If Player(Current).NumResources >= CloakingCost Then
  307.     'do nothing
  308.     PlaySoundEffect "Quiet"
  309.     MsgBox "The Cloaking Device costs 3 resources to power up", , "Device Not Installed"
  310.     chkCloak.Value = 0
  311. End If
  312. End Sub
  313. Private Sub chkSabotage_Click()
  314. If chkSabotage.Value = 0 Then
  315.     'clean up
  316.     Frame1.Enabled = True
  317.     If Planet(ActivePlanet).Troops = 0 Then
  318.         hsbTroopsOnShip.Enabled = False
  319.     Else
  320.         hsbTroopsOnShip.Value = 0
  321.         lblNumRegularTroops.Caption = 0
  322.     End If
  323.     If Planet(ActivePlanet).AssaultTroops = 0 Then
  324.         hsbAssaultTroopsOnShip.Enabled = False
  325.     Else
  326.         lblNumAssaultTroops.Caption = 0
  327.         hsbAssaultTroopsOnShip.Value = 0
  328.     End If
  329.     chkSabotage.Value = 0
  330.     chkCloak.Value = 0
  331. End If
  332. 'make sure player has at least 1 mech to go on sabotage mission
  333. If chkSabotage.Value = 1 Then
  334.     If Planet(ActivePlanet).AssaultTroops < 1 Then
  335.         PlaySoundEffect "Quiet"
  336.         MsgBox "You must have at least one mech to" + Chr(13) + "carry out this mission.", vbOKOnly, "Mission Failure"
  337.         chkSabotage.Value = 0
  338.         Exit Sub
  339.     Else
  340.         'set up the mission
  341.         Frame1.Enabled = False
  342.         hsbTroopsOnShip.Value = 0
  343.         hsbTroopsOnShip.Enabled = False
  344.         hsbAssaultTroopsOnShip.Value = 1
  345.         hsbAssaultTroopsOnShip.Enabled = False
  346.         cmdLaunchShip.Enabled = True
  347.     End If
  348. End If
  349. End Sub
  350. Private Sub cmdCancel_Click()
  351. 'unload the form without doing anything
  352. Unload frmLaunch
  353. End Sub
  354. Private Sub cmdLaunchShip_Click()
  355. Dim CloakingCost As Integer
  356. CloakingCost = 3
  357. If hsbTroopsOnShip.Value = 0 And hsbAssaultTroopsOnShip = 0 Then
  358.     PlaySoundEffect "Quiet"
  359.     MsgBox "At least one troop or mech is required to operate the ship.", vbOKOnly + vbInformation, "Empty Ship"
  360.     cmdLaunchShip.Enabled = False
  361.     Exit Sub
  362. End If
  363. 'update the ship with troops etc
  364. With Player(Current).Ship(activeship)
  365.      .Launched = True
  366.      .Troops = hsbTroopsOnShip.Value
  367.      .AssaultTroops = hsbAssaultTroopsOnShip.Value
  368.      .Coordinate = Planet(ActivePlanet).Coordinate
  369.      .WarpPosition = 1
  370.      .CenterX = frmGameScreen.picPlanet(ActivePlanet).Left + (frmGameScreen.picPlanet(ActivePlanet).Width / 2)
  371.      .CenterY = frmGameScreen.picPlanet(ActivePlanet).Top + (frmGameScreen.picPlanet(ActivePlanet).Height / 2)
  372.      .ShipNumber = activeship    'set ship number to 0 or 1
  373. End With
  374. If chkSabotage.Value = 1 Then
  375.     Player(Current).Ship(activeship).Sabotage = True
  376. End If
  377. 'determine combatstrength
  378. Player(Current).Ship(activeship).CombatStrength = 0
  379. 'laser and plasma for troops?
  380. Dim X, Y
  381. X = hsbTroopsOnShip.Value
  382. Y = hsbAssaultTroopsOnShip.Value
  383. If Player(Current).LaserResearched Then
  384.     X = Int(X * 1.15)
  385. End If
  386. If Player(Current).PlasmaResearched Then
  387.     X = Int(X * 1.3)
  388. End If
  389. '****Main Formula:
  390. Player(Current).Ship(activeship).CombatStrength = X + (Y * 5)
  391. '****
  392. 'shields
  393. Dim Q As Integer
  394. Q = 0
  395. If Player(Current).ShipShield1Researched Then
  396.     Q = 5
  397. End If
  398. If Player(Current).ShipShield2Researched Then
  399.     Q = Q + 5
  400. End If
  401. Player(Current).Ship(activeship).CombatStrength = Player(Current).Ship(activeship).CombatStrength + Q
  402. 'end shields
  403.       
  404.        
  405. 'cloaking device
  406. If chkCloak.Value = 1 Then
  407.     Player(Current).Ship(activeship).HaveCloakingDevice = True
  408.     Player(Current).NumResources = Player(Current).NumResources - CloakingCost
  409. End If
  410. 'update player stats
  411. frmGameScreen.UpdatePlayerStats
  412. 'update planet stats
  413. With Planet(ActivePlanet)
  414.     .Troops = Planet(ActivePlanet).Troops - hsbTroopsOnShip.Value
  415.     .AssaultTroops = Planet(ActivePlanet).AssaultTroops - hsbAssaultTroopsOnShip.Value
  416.     'adjust combat strength
  417.      SetCombatStrength (ActivePlanet)
  418. End With
  419. 'disable the planet management frame
  420. frmGameScreen.ClearFrame
  421. PlaySoundEffect "Launch"
  422. 'unload the launch form and return to game
  423. Unload frmLaunch
  424. End Sub
  425. Private Sub cmdShip1_Click()
  426. 'set ship(0) as the one to be launched
  427. activeship = 0
  428. '***Scroll Bars*****
  429. 'see if regular troop scroll bar should be enabled
  430. If Planet(ActivePlanet).Troops > 0 Then
  431.     fraTactical.Enabled = True
  432.     hsbTroopsOnShip.Enabled = True
  433.     If Player(Current).BigShipResearched = False Then
  434.         'set max values for regular troop scroll bar
  435.         'limit max troops to 25
  436.         hsbTroopsOnShip.Max = Planet(ActivePlanet).Troops
  437.         If Planet(ActivePlanet).Troops > 25 Then
  438.             hsbTroopsOnShip.Max = 25
  439.         End If
  440.     ElseIf Player(Current).BigShipResearched Then
  441.         'no limit
  442.         hsbTroopsOnShip.Max = Planet(ActivePlanet).Troops
  443.     End If
  444. End If
  445. 'see if assault troops scroll bar should be enabled
  446. If Player(Current).MechResearched And Planet(ActivePlanet).AssaultTroops > 0 Then
  447.     fraTactical.Enabled = True
  448.     hsbAssaultTroopsOnShip.Enabled = True
  449.     hsbAssaultTroopsOnShip.Max = Planet(ActivePlanet).AssaultTroops
  450.     If Player(Current).BigShipResearched = False Then
  451.        'set max value for scrollbar - limit of 5
  452.        If Planet(ActivePlanet).AssaultTroops > 5 Then
  453.           hsbAssaultTroopsOnShip.Max = 5
  454.        End If
  455.     ElseIf Player(Current).BigShipResearched = True Then
  456.         'no limit on mechs on board
  457.         hsbAssaultTroopsOnShip.Max = Planet(ActivePlanet).AssaultTroops
  458.     End If
  459. End If
  460. '*****Advanced Tactics Frame*****
  461. 'Sabotage checkbox - only if mechs and shields1 researched already
  462. If Player(Current).MechResearched And Player(Current).ShipShield1Researched = True Then
  463.   chkSabotage.Enabled = True
  464. End If
  465. 'Cloaking checkbox
  466. If Player(Current).CloakingResearched Then
  467.     chkCloak.Enabled = True
  468. End If
  469. End Sub
  470. Private Sub cmdShip2_Click()
  471. 'set ship(1) as the one to be launched
  472. activeship = 1
  473. '***Scroll Bars*****
  474. 'see if regular troop scroll bar should be enabled
  475. If Planet(ActivePlanet).Troops > 0 Then
  476.     fraTactical.Enabled = True
  477.     hsbTroopsOnShip.Enabled = True
  478.     If Player(Current).BigShipResearched = False Then
  479.         'set max values for regular troop scroll bar
  480.         'limit max troops to 25
  481.         hsbTroopsOnShip.Max = Planet(ActivePlanet).Troops
  482.         If Planet(ActivePlanet).Troops > 25 Then
  483.             hsbTroopsOnShip.Max = 25
  484.         End If
  485.     ElseIf Player(Current).BigShipResearched Then
  486.         'no limit
  487.         hsbTroopsOnShip.Max = Planet(ActivePlanet).Troops
  488.     End If
  489. End If
  490. 'see if assault troops scroll bar should be enabled
  491. If Planet(ActivePlanet).AssaultTroops > 0 Then
  492.     fraTactical.Enabled = True
  493.     hsbAssaultTroopsOnShip.Enabled = True
  494.     hsbAssaultTroopsOnShip.Max = Planet(ActivePlanet).AssaultTroops
  495.     If Player(Current).BigShipResearched = False Then
  496.        'set max value for scrollbar - limit of 5
  497.        If Planet(ActivePlanet).AssaultTroops > 5 Then
  498.           hsbAssaultTroopsOnShip.Max = 5
  499.        End If
  500.     ElseIf Player(Current).BigShipResearched = True Then
  501.         'no limit on mechs on board
  502.         hsbAssaultTroopsOnShip.Max = Planet(ActivePlanet).AssaultTroops
  503.     End If
  504. End If
  505. '*****Advanced Tactics Frame*****
  506. 'Sabotage checkbox - only if mechs and ship shields 1 researched already
  507. If Player(Current).MechResearched And Player(Current).ShipShield1Researched Then
  508.    chkSabotage.Enabled = True
  509. End If
  510. 'Cloaking checkbox
  511. If Player(Current).CloakingResearched Then
  512.     chkCloak.Enabled = True
  513. End If
  514. End Sub
  515. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  516. Select Case KeyCode
  517.     Case vbKeyEscape
  518.         'show quick help
  519.         ShowQuickHelp
  520. End Select
  521. End Sub
  522. Private Sub Form_Load()
  523. 'check which ships are available for launching, if any
  524. If Player(Current).Ship(0).Launched Then
  525.     cmdShip1.Enabled = False
  526. End If
  527. If Player(Current).Ship(1).Launched Then
  528.     cmdShip2.Enabled = False
  529. End If
  530. 'disable ship 2 if ship 1 is available
  531. If Player(Current).Ship(0).Launched = False Then
  532.     cmdShip2.Enabled = False
  533. End If
  534. 'initial values for the labels
  535. lblNumRegularTroops = 0
  536. lblNumAssaultTroops = 0
  537. End Sub
  538. Private Sub hsbAssaultTroopsOnShip_Change()
  539. 'adjust label as scroll bar used
  540. lblNumAssaultTroops.Caption = hsbAssaultTroopsOnShip.Value
  541. 'enable the launch button if more than 0 troops selected
  542. If hsbAssaultTroopsOnShip.Value >= 1 Then
  543.     cmdLaunchShip.Enabled = True
  544. End If
  545. End Sub
  546. Private Sub hsbAssaultTroopsOnShip_Scroll()
  547. lblNumAssaultTroops.Caption = hsbAssaultTroopsOnShip.Value
  548. End Sub
  549. Private Sub hsbTroopsOnShip_Change()
  550. 'update the label caption with the value
  551. lblNumRegularTroops.Caption = hsbTroopsOnShip.Value
  552. 'enable the launch button if more than 0 troops selected
  553. If hsbTroopsOnShip.Value >= 1 Then
  554.     cmdLaunchShip.Enabled = True
  555. End If
  556. End Sub
  557. Private Sub hsbTroopsOnShip_Scroll()
  558. 'update the label caption
  559. lblNumRegularTroops.Caption = hsbTroopsOnShip.Value
  560. 'enable the launch button if more than 0 troops selected
  561. If hsbTroopsOnShip.Value >= 1 Then
  562.     cmdLaunchShip.Enabled = True
  563. End If
  564. End Sub
  565.